/*
		In this challenge, write a program that takes in three arguments,
		a start temperature (in Celsius), an end temperature (in Celsius)
		and a step size. Print out a table that goes from the start temperature
		to the end temperature, in steps of the step size; you do not actually
		need to print the final end temperature if the step size does not exactly match.
		You should perform input validation: do not accept start temperatures
		less than a lower limit (which your code should specify as a constant)
		or higher than an upper limit (which your code should also specify).
		You should not allow a step size greater than the difference in temperatures.
*/
#include <iostream>
#include <valarray>

using namespace std;

int main(){
	int MaxTemp = 0;
	int MinTemp = 0;
	int Step = 1;

	while (abs(MinTemp) > 32767 or abs(MaxTemp) > 32767 or Step > abs(MaxTemp) - abs(MinTemp)) {
		cout << "Min temp: ";
		cin >> MinTemp;

		cout << "Max temp: ";
		cin >> MaxTemp;

		cout << "Step: ";
		cin >> Step;
	}

	cout << "Min temp: " << MinTemp << endl;
	cout << "Max temp: " << MaxTemp << endl;

	cout << "Celsius\t\tFahrenheit" << endl;
	cout << "----------------------------------" << endl;

	for (int i=MinTemp; i <= MaxTemp; i+=Step){

		//[°F] = [°C] × 9⁄5 + 32	[°C] = ([°F] − 32) × 5⁄9
		cout << i << "\t\t" << i*9/5+32 << endl;

	}

return 0;
}
